package com.bnlr.lrparking.util;

import android.view.View;
import android.widget.TextView;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by rr on 2017/5/10.
 */

public class IsPhoneFormatUtils {


    //验证手机号是否正确ֻ
    public static boolean isMobileNO(String mobiles) {
        Pattern p = Pattern.compile("^(13[0-9]|14[57]|15[0-35-9]|17[6-8]|18[0-9])[0-9]{8}$");
        Matcher m = p.matcher(mobiles);
        return m.matches();
    }



    public static void IsPhoneFormat(String phone, final TextView textView){
        if (isMobileNO(phone) || phone.length()==11){
            textView.setEnabled(true);
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    CountDownTimerUtils mCountDownTimerUtils = new CountDownTimerUtils(textView, 10000, 1000);
                    mCountDownTimerUtils.start();
                }
            });
        }else {
            textView.setEnabled(false);
        }
    }


}
